package day3.Exer;

import java.util.Scanner;


public class Exer2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
       System.out.println("请输入字符串：");
        String str = "123.55";
        for (int i = 0; i < str.length(); i++) {
            try {
                Double.parseDouble(str);
            } catch (Exception e) {
                str = str.substring(0,str.length()-1);
                    continue;
            }
        }
        System.out.println(Double.parseDouble(str));
    }
}
